//
//  RecommendCell.m
//  WorkNest
//
//  Created by qbm360 on 15/8/27.
//  Copyright (c) 2015年 nest. All rights reserved.
//

#import "RecommendCell.h"

@interface RecommendCell()

@property (weak, nonatomic) IBOutlet UIButton *selectButton;
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (weak, nonatomic) IBOutlet UILabel *productName;
@property (weak, nonatomic) IBOutlet UILabel *count;
@property (weak, nonatomic) IBOutlet UILabel *price;

@end

@implementation RecommendCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setIfSelected:(BOOL)ifSelected {
    _ifSelected = ifSelected;
    _selectButton.selected = _ifSelected;
}

- (IBAction)selectButton:(id)sender {
    _ifSelected = !_ifSelected;
    _selectButton.selected = _ifSelected;
    [_delegate didSelectCheckButtonAtIndexPath:_indexPath ifcheck:_ifSelected];
}

- (void)setModel:(ProductModel *)model {
    _model = model;
    [self.image setImageWithURL:[NSURL URLWithString:[UIUtil containString:_model.mainImage]] placeholderImage:[UIImage imageNamed:@"tupian"]];
    self.productName.text = _model.productName;
    self.price.text = [NSString stringWithFormat:@"￥%.2f",[_model.quotation floatValue]];
    self.count.text = [NSString stringWithFormat:@"销售量:%@件",_model.bookedQuantity];
}

@end
